from math import gcd

def lcm(x: int, y: int) -> int:
    return int(abs(x*y) / gcd(x,y))

class fenshu:
    def __init__(self, a: int, b: int):
        self.a = a
        self.b = b
    def __str__(self):
        return f"{self.a}/{self.b}"
    
    def yuefen(self):
        gcd_ab = gcd(self.a, self.b)
        self.a //= gcd_ab
        self.b //= gcd_ab
    
    def __add__(self, other: 'fenshu'):
        newa = self.a*other.b + self.b*other.a
        newb = self.b*other.b
        assert type(newa) == int and type(newb) == int, "Error: result is not an integer"
        re = fenshu(newa, newb)
        re.yuefen()
        return re
    
    def __sub__(self, other: 'fenshu'):
        newa = self.a*other.b - self.b*other.a
        newb = self.b*other.b
        assert type(newa) == int and type(newb) == int, "Error: result is not an integer"
        re = fenshu(newa, newb)
        re.yuefen()
        return re
    
    def __mul__(self, other: 'fenshu'):
        newa = self.a*other.a
        newb = self.b*other.b
        assert type(newa) == int and type(newb) == int, "Error: result is not an integer"
        re = fenshu(newa, newb)
        re.yuefen()
        return re
    
    def __truediv__(self, other: 'fenshu'):
        newa = self.a*other.b
        newb = self.b*other.a
        assert type(newa) == int and type(newb) == int, "Error: result is not an integer"
        re = fenshu(newa, newb)
        re.yuefen()
        return re

if __name__ == '__main__':
    a = 2
    b = 3
    c = 3
    d = 7
    fena = fenshu(a, b)
    fend = fenshu(c, d)
    print(f"({fena})+({fend})={fena+fend}")
    print(f"({fena})-({fend})={fena-fend}")
    print(f"({fena})*({fend})={fena*fend}")
    print(f"({fena})/({fend})={fena/fend}")